package ticker.manager 
{
	/**
	 * 通过帧频进行控制的TickerManger
	 * @author gcxk721
	 */
	public class FrameTickerManager extends BaseTickerManager 
	{
		
		/**
		 * 帧频之间的间隔
		 * 值为0
		 * 
		 */
		private var _delay : int;
		
		/**
		 * 计数器
		 */
		private var _tmpDelay : int = 0;
		
		/**
		 * 累计时间
		 */
		private var _tmpTime : int = 0;
		
		/**
		 * 构造函数
		 * @param	delay
		 * 帧频间隔     0为没有间隔
		 */
		public function FrameTickerManager(tickName : String, delay : uint = 0) 
		{
			super(tickName);
			_delay = delay;
			_tmpDelay = delay;
		}
		
		override public function onTicker(time:int):void 
		{
			_tmpTime += time;
			if (_tmpDelay == 0)
			{
				for (var i : int = 0; i < lstLength; ++i)
				{
					tickerLst[i].onTicker(_tmpTime);
				}
				_tmpDelay = _delay;
				_tmpTime = 0;
			}
			else
			{
				_tmpDelay--;
			}
		}
		
	}

}